@extends('layouts.tankuang')

@section('content')
    <form name="add_form" id="add_form" action="{{url('admin/units/add_baowei',$id)}}" method="post" enctype="multipart/form-data">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <div id="frdj">
            <h2 class="text-center mg_b36 mg_t25" style="font-weight: bold;">重点岗位人员登记表</h2>
            <table class="table-form table-border mg-auto">
                <tr>
                    <td class="font-bd" width="10%">单位名称</td>
                    <td><input type="text" class="form-input easyui-validatebox" value="{{$re->unit_name}}" name="unit_name" data-options="required:true,missingMessage:'单位名称不能为空',validateOnCreate:false,validateOnBlur:true"></td>
                    <td class="font-bd">姓名</td>
                    <td><input type="text" class="form-input easyui-validatebox" value="{{$re->name}}" name="name" data-options="required:true,missingMessage:'姓名不能为空',validateOnCreate:false,validateOnBlur:true"></td>
                    <td class="font-bd">性别</td>
                    <td>
                        <select name="sex" class="w153 input_all">
                            <option value="男" @if($re->sex =='男')selected @endif>男</option>
                            <option value="女" @if($re->sex =='女')selected @endif>女</option>
                        </select>
                    </td>
                    <td rowspan="6">
                        @if($re->pic != '')
                            <div class="example" style="width: 120px;"><img src="{{ URL::asset('/') }}{{$re->pic}}"  class="fileImg" alt="" width="120px"></div>
                        @endif
                        <div class="box_bt">
	                    	<span class="img_add"><img src="{{URL::asset('/')}}css/icons/edit_add.png">修改图像</span>
	                      	 <input class="box_file" type="file" name="pic">
	                    </div>
                    </td>
                </tr>
                <tr>
                    <td class="font-bd">出生年月</td>
                    <td>
                        <input class="easyui-datebox w150 easyui-validatebox" value="{{$re->birthday}}" name="birthday" data-options="required:true,missingMessage:'出生年月不能为空',validateOnCreate:false,validateOnBlur:true">
                    </td>
                    <td class="font-bd">民族</td>
                    <td>
                        <select class="w153 input_all easyui-validatebox" name="nation" data-options="required:true,missingMessage:'民族不能为空',validateOnCreate:false,validateOnBlur:true">
                            <option value="">请选择</option>
                            @foreach($nation as $v)
                                <option value="{{$v->nation}}" @if($re->nation == $v->nation)selected @endif>{{$v->nation}}</option>
                            @endforeach
                        </select>
                    </td>
                    <td class="font-bd">籍贯</td>
                    <td>
                        <input type="text" class="form-input easyui-validatebox" value="{{$re->native_place}}" name="native_place" data-options="required:true,missingMessage:'籍贯不能为空',validateOnCreate:false,validateOnBlur:true">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd">文化程度</td>
                    <td>
                        <select class="w153 input_all easyui-validatebox" name="education" data-options="required:true,missingMessage:'文化程度不能为空',validateOnCreate:false,validateOnBlur:true">
                            <option value="">请选择</option>
                            <option value="博士" @if($re->education =='博士')selected @endif>博士</option>
                            <option value="硕士" @if($re->education =='硕士')selected @endif>硕士</option>
                            <option value="本科" @if($re->education =='本科')selected @endif>本科</option>
                            <option value="专科" @if($re->education =='专科')selected @endif>专科</option>
                            <option value="中专" @if($re->education =='中专')selected @endif>中专</option>
                            <option value="高中" @if($re->education =='高中')selected @endif>高中</option>
                            <option value="初中" @if($re->education =='初中')selected @endif>初中</option>
                            <option value="小学" @if($re->education =='小学')selected @endif>小学</option>
                        </select>
                    </td>
                    <td class="font-bd">政治面貌</td>
                    <td>
                        <select class="w153 input_all easyui-validatebox" name="political_status" data-options="required:true,missingMessage:'政治面貌不能为空',validateOnCreate:false,validateOnBlur:true">
                            <option value="">请选择</option>
                            <option value="中共党员" @if($re->political_status == '中共党员')selected @endif>中共党员</option>
                            <option value="团员" @if($re->political_status == '团员')selected @endif>团员</option>
                            <option value="民主党派" @if($re->political_status == '民主党派')selected @endif>民主党派</option>
                            <option value="无" @if($re->political_status == '无')selected @endif>无</option>
                        </select>
                    </td>
                    <td class="font-bd">要害部门</td>
                    <td>
                        <input type="text" class="form-input" value="{{$re->position}}" name="position">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd">身份证号</td>
                    <td colspan="3">
                        <input type="text" class="form-input easyui-validatebox" value="{{$re->id_number}}" name="id_number" data-options="required:true,validType:'idcard',missingMessage:'身份证号不能为空',invalidMessage:'请输入正确的身份证号',validateOnCreate:false,validateOnBlur:true">
                    </td>
                    <td class="font-bd">联系电话</td>
                    <td>
                        <input type="text" class="form-input" value="{{$re->phone}}" name="phone">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd">家庭住址</td>
                    <td colspan="3">
                        <input type="text" class="form-input" value="{{$re->address}}" name="address">
                    </td>
                    <td class="font-bd">电子邮箱</td>
                    <td><input type="text" class="form-input" value="{{$re->email}}" name="email"></td>
                </tr>
                <tr>
                    <td class="font-bd">人事关系</td>
                    <td>
                        <select class="w153 input_all" id="guanxi" name="guanxi">
                            <option value="自招" @if($re->guanxi == '自招')selected @endif>自招</option>
                            <option value="在职职工" @if($re->guanxi == '在职职工')selected @endif>在职职工</option>
                            <option value="外聘" @if($re->guanxi == '外聘')selected @endif>外聘</option>
                        </select>
                    </td>
                    <td class="font-bd">上岗时间</td>
                    <td>
                        <input class="easyui-datebox w153" value="{{$re->shanggang_time}}" name="shanggang_time">
                    </td>
                    <td class="font-bd">离岗时间</td>
                    <td>
                        <input class="easyui-datebox w153" value="{{$re->ligang_time}}" name="ligang_time">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd">备注</td>
                    <td colspan="7">
                        <textarea class="textarea" name="remark">{{$re->remark}}</textarea>
                    </td>
                </tr>
            </table>
            {{--<div class="wbt mg_t25 mg_b18">
                <span class="font-bd">填报单位：</span>
                <input type="text" class="w250 input_bottom dsp" name="tbdw" value="{{$re->tbdw}}">
                <span class="itv"></span>
                <span class="font-bd">填报人：</span>
                <input type="text" class="w250 input_bottom dsp" name="tbr" value="{{$re->tbr}}">
            </div>--}}
            <div class="wbt mg_t25 text-center">
                <button id="go" type="button" class="easyui-linkbutton dsp" data-options="iconCls:'icon-save'">确定</button>
                <a href="{{url('admin/units/print_zdry',$id)}}" target="_blank" id="goToPageB" class="easyui-linkbutton dsp print" data-options="iconCls:'icon-print'">打印</a>
                <button type="button" class="easyui-linkbutton dsp" data-options="iconCls:'icon-no'" onclick="$('#tk').window('close')">关闭</button>
            </div>
        </div>
    </form>

    <link rel="stylesheet" href="{{ URL::asset('/') }}css/zoomify.min.css">
    <script src="{{ URL::asset('/') }}js/zoomify.min.js"></script>
    <script type="text/javascript">
        $('.example img').zoomify(function(){
            $(this).css({'position':'absolute','top':0,'bottom':0,'left':0,'right':0,'z-index':'9999',})
        });
    </script>
    <script>
        $('#go').click(function (){
        	if(!$("#add_form").form('validate')){
				return false;
				}
            var formData = new FormData($("#add_form")[0]);
            $.ajax({
                type: "POST",
                url: "{{url('admin/units/edit_zdry',$id)}}",
                data: formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                /*error: function(data) {
                    $.messager.alert('信息提示',data.msg,'info');
                },*/
                success: function(data) {
                    $.messager.alert('信息提示',data.msg,'info');
                    $('#tk').dialog('close');
                    $('.pagination-load').click();
                },
                error: function(msg) {
                    var json=JSON.parse(msg.responseText);
                    $.each(json, function(index, value) {
                        $.messager.alert('信息提示',value,'info');die;
                    });
                },
            });
        });
    </script>
@stop